ComponentOne Basic Library for UWP
Locking the Control from Editing
UWP Edition Basic Library > Input for UWP > Input for UWP Task-Based Help > C1MaskedTextBox Task-Based Help > Locking the Control from Editing

By default the C1MaskedTextBox control's C1MaskedTextBox.Value property is editable by users at run time. If you want to lock the control from being edited, you can set the IsReadOnly property to True.

At Design Time

To lock the C1MaskedTextBox control from run-time editing, complete the following steps:

  1. Click the C1MaskedTextBox control once to select it.
  2. Navigate to the Properties tab and check the IsReadOnly check box.

This will set the IsReadOnly property to False.

In XAML

To lock the C1MaskedTextBox control from run-time editing in XAML add IsReadOnly="True" to the <Xaml:C1MaskedTextBox> tag so that it appears similar to the following:

Markup
Copy Code
<Xaml:C1MaskedTextBox Height="23" Name="C1MaskedTextBox1" Width="120" IsReadOnly="True"></Xaml:C1MaskedTextBox>

In Code

To lock the C1MaskedTextBox control from run-time editing add the following code to your project:

Visual Basic
Copy Code
C1MaskedTextBox1.IsReadOnly = True

C#
Copy Code
c1MaskedTextBox1.IsReadOnly = true;

Run your project and observe:

The control is locked from editing. Try to click the cursor within the control – notice that the text insertion point (the blinking vertical line) will not appear in the control.

See Also